<script setup>
import { ref } from 'vue'
import bus from '../utils/bus'


const price = ref(100)
const pro=ref('')
function btnClick() {
    bus.emit('a', price)

}
bus.on('buypro',(val)=>{
        console.log('组件1 接收到信息了' + val.value);
        pro.value = val.value
    })

</script>
<template>

    <div>
        <h1>组件 1 -- {{ price }} -- {{ pro }} </h1>
        <button @click="btnClick">传递给组件2</button>
    </div>

</template>
<style scoped>
div {
    width: 80%;
    height: 100px;
    border: 10px solid red;
}
</style>